home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Taifun
/
Taifun 117 (1989-11-15)(Ossowski, Stefan)(DE)(PD).zip
/
Taifun 117 (1989-11-15)(Ossowski, Stefan)(DE)(PD).adf
/
PrintIt
/
PrintItDisplay.mod
< prev
next >
Wrap
Text File
|
1989-08-20
|
22KB
|
675 lines
(*-------------------------------------------------------------------------*)
(* *)
(* This handles PrintIt!'s Display *)
(* *)
(*-------------------------------------------------------------------------*)
IMPLEMENTATION MODULE PrintItDisplay;
(*------------------------- IMPORTs: ------------------------------------*)
(*------ SYSTEM: ------*)
FROM SYSTEM IMPORT ADR, ADDRESS, SHIFT, BITSET, LONGSET, CAST;
FROM Arts IMPORT TermProcedure, Terminate;
(*------ Libraries: ------*)
FROM Exec IMPORT AllocMem, FreeMem, MemReqs, MemReqSet, Forbid, Permit;
FROM Intuition IMPORT Gadget, GadgetFlags, GadgetFlagSet, boolGadget,
ActivationFlags, ActivationFlagSet, WindowPtr,
NewWindow, WindowFlags, WindowFlagSet, ScreenFlags,
ScreenFlagSet, IDCMPFlags, IDCMPFlagSet, OpenWindow,
CloseWindow, RefreshGadgets, strGadget, StringInfo,
IntuiMessagePtr, GadgetPtr, RethinkDisplay, OpenScreen,
CloseScreen, ScreenPtr, NewScreen, ScreenToFront,
WBenchToFront, MakeScreen, DisplayBeep, customScreen;
FROM Graphics IMPORT SetAPen, SetBPen, SetDrMd, RastPortPtr, RectFill,
Move, Draw, Text, jam1, jam2, ViewModes, ViewModeSet,
BltClear, SetRGB4, ReadPixel, WritePixel, BitMap;
FROM Exec IMPORT WaitPort, GetMsg, ReplyMsg;
(*------ Standard: ------*)
FROM Strings IMPORT Length;
(*------------------- Variables from Definition: --------------------------
TYPE
Gadgets = (hori1ID,hori2ID,hori3ID,hori4ID,hori5ID,hori6ID,hori7ID,hori8ID,
vert1ID,vert2ID,vert3ID,vert4ID,vert5ID,vert6ID,vert7ID,vert8ID,
PrintNormalID,PrintDoubleID,DpiH60ID,DpiH72ID,DpiH80ID,DpiH90ID,
DpiH120ID,DpiH144ID,DpiH240ID,DpiV72ID,DpiV144ID,DpiV216ID,
PositiveID,PrintItID,LoadPicID,ResetID);
TextType = ARRAY[0..79] OF CHAR;
VAR
Window: WindowPtr;
Gadgs: ARRAY Gadgets OF Gadget;
RP: RastPortPtr;
PixName: TextType; (* Pic's Name *)
StretchX: CARDINAL; (* horizontal Stretch-Value *)
StretchY: CARDINAL; (* vertical Stretch-Value *)
DoublePrint: BOOLEAN; (* Print it Twice ? *)
Positive: BOOLEAN; (* Reverse or not ? *)
xRes: Gadgets; (* horizontal DPI (DpiHxxID) *)
yRes: Gadgets; (* vertical DPI (DpiVxxID) *)
Screen: ScreenPtr; (* Screen containing Picture *)
Shade: CARDINAL; (* For Color -> BW conversion *)
----------------------- Internal needed Variables: ----------------------*)
VAR
IDCount: Gadgets;
NuWindow: NewWindow;
i,j: CARDINAL;
NameWindow, ConvertWindow: WindowPtr;
TextGadg,OKGadg,CancelGadg: Gadget;
TextInfo: StringInfo;
ShadeGadget: ARRAY[0..15] OF Gadget;
UsePlaneGadget, ScaleGadget, ConvertGadget: Gadget;
gadget: GadgetPtr;
PlaneString: ARRAY[0..1] OF CHAR;
Msg: IntuiMessagePtr;
map: ADDRESS;
LightColors: LONGSET;
WordPtr: POINTER TO BITSET;
Color: CARDINAL;
x,y: CARDINAL;
li: LONGINT;
Scales: ARRAY[0..4],[0..15],[0..1] OF LONGCARD; (* Grey Scales *)
(* ^Col ^Bit# ^y-Position *)
GreyScreen: ScreenPtr; (* Greyscale-Screen *)
NuScreen: NewScreen;
(*---------------------- Internal Procedures: ---------------------------*)
(*------ Set a Bool-Gadget: ------*)
PROCEDURE SetBool(VAR Gadg: Gadget; x,y,w,h: INTEGER);
BEGIN
WITH Gadg DO
nextGadget := NIL;
leftEdge := x; topEdge := y;
width := w; height := h;
flags := GadgetFlagSet{};
activation := ActivationFlagSet{gadgImmediate,toggleSelect};
gadgetType := boolGadget;
gadgetRender := NIL;
selectRender := NIL;
gadgetText := NIL;
mutualExclude:= LONGSET{};
specialInfo := NIL;
gadgetID := 0;
userData := NIL;
END;
END SetBool;
(*------ Draw A Box: ------*)
PROCEDURE Box(rp: RastPortPtr; x,y,X,Y: INTEGER);
BEGIN
Move(rp,x,y); Draw(rp,X,y); Draw(rp,X,Y); Draw(rp,x,Y); Draw(rp,x,y);
END Box;
(*------ Type Text: ------*)
TYPE
TypeTextType = POINTER TO ARRAY[0..999] OF CHAR;
PROCEDURE Type(rp: RastPortPtr; x,y: INTEGER; text:TypeTextType);
BEGIN
Move(rp,x,y); Text(rp,text,Length(text^));
END Type;
(*-------------------------------------------------------------------------*)
(* *)
(* Open the Screen: *)
(* *)
(*-------------------------------------------------------------------------*)
PROCEDURE OpenPrintIt();
BEGIN
(*------ Gadgets: ------*)
FOR IDCount := hori1ID TO hori8ID DO
SetBool(Gadgs[IDCount],129+16*ORD(IDCount),27,15,11);
END;
FOR IDCount := vert1ID TO vert8ID DO
SetBool(Gadgs[IDCount],1+16*ORD(IDCount),43,15,11);
END;
SetBool(Gadgs[PrintNormalID], 77, 59, 79,11);
SetBool(Gadgs[PrintDoubleID],157, 59, 79,11);
FOR IDCount := DpiH60ID TO DpiH90ID DO
SetBool(Gadgs[IDCount],65+24*(ORD(IDCount)-ORD(DpiH60ID)),75,23,11);
END;
FOR IDCount := DpiH120ID TO DpiH240ID DO
SetBool(Gadgs[IDCount],161+32*(ORD(IDCount)-ORD(DpiH120ID)),75,31,11);
END;
SetBool(Gadgs[DpiV72ID ], 65, 91, 63,11);
SetBool(Gadgs[DpiV144ID ],129, 91, 63,11);
SetBool(Gadgs[DpiV216ID ],193, 91, 63,11);
SetBool(Gadgs[PositiveID], 9, 43, 64,11);
SetBool(Gadgs[PrintItID ], 9,107,111,11);
SetBool(Gadgs[LoadPicID ], 9,119,111,11);
SetBool(Gadgs[ResetID ], 9,131,111,11);
(*------ Link Gadgets: ------*)
FOR IDCount := hori1ID TO LoadPicID DO
WITH Gadgs[IDCount] DO
nextGadget := ADR(Gadgs[Gadgets(ORD(IDCount)+1)]);
gadgetID := ORD(IDCount);
END;
END;
WITH Gadgs[ResetID] DO
nextGadget := NIL;
gadgetID := ORD(ResetID)
END;
(*------ Window: ------*)
WITH NuWindow DO
leftEdge := 188; topEdge := 71;
width := 264; height := 146;
detailPen := 0; blockPen := 1;
idcmpFlags := IDCMPFlagSet{gadgetDown,closeWindow};
flags := WindowFlagSet{windowDrag,windowDepth,windowClose,activate,
noCareRefresh};
firstGadget:= ADR(Gadgs);
checkMark := NIL;
title := ADR("Print It !");
screen := NIL;
bitMap := NIL;
type := ScreenFlagSet{wbenchScreen};
END;
Window := OpenWindow(NuWindow);
RP := Window^.rPort;
(*------ Draw into Window: ------*)
SetAPen(RP,2); SetDrMd(RP,jam1);
FOR i:= 128 TO 240 BY 16 DO
Box(RP,i,26,i+16,38);
Box(RP,i,42,i+16,54);
END;
Box(RP, 76, 58,236, 70); Move(RP,156,58); Draw(RP,156,70);
Box(RP, 8, 42, 73, 54);
FOR i:=64 TO 144 BY 24 DO
Box(RP,i,74,i+24,86);
END;
FOR i:= 160 TO 224 BY 32 DO
Box(RP,i,74,i+32,86);
END;
FOR i:= 64 TO 192 BY 64 DO
Box(RP,i,90,i+64,102);
END;
FOR i:= 106 TO 130 BY 12 DO
Box(RP,8,i,120,i+12);
END;
Box(RP,136,108,248,140);
(*------ Type Text into Window: -------*)
SetAPen(RP,1);
Type(RP, 8, 23,ADR("Pic:"));
Type(RP, 8, 35,ADR("Stretch:"));
Type(RP, 80, 35,ADR("hori:"));
Type(RP, 80, 51,ADR("vert:"));
Type(RP,132, 35,ADR("1 2 3 4 5 6 7 8"));
Type(RP,132, 51,ADR("1 2 3 4 5 6 7 8"));
Type(RP, 8, 67,ADR("Print:"));
Type(RP, 92, 67,ADR("Single Double"));
Type(RP, 8, 92,ADR("Dpi:"));
Type(RP, 32, 83,ADR("hor:"));
Type(RP, 32, 99,ADR("ver: 72"));
Type(RP, 68, 83,ADR("60 72 80 90 120 144 240"));
Type(RP,148, 99,ADR("144 216"));
Type(RP, 24,115,ADR("Print It !"));
Type(RP, 32,127,ADR("Load Pic"));
Type(RP, 44,139,ADR("Reset"));
END OpenPrintIt;
(*-------------------------------------------------------------------------*)
(* *)
(* Get Picture's Name *)
(* *)
(*-------------------------------------------------------------------------*)
PROCEDURE GetName();
BEGIN
(*------ Gadgets: ------*)
SetBool(OKGadg ,164, 30, 67,11);
SetBool(CancelGadg, 8, 30, 67,11);
SetBool(TextGadg , 12, 16,216, 8);
WITH TextGadg DO
nextGadget := ADR(OKGadg);
activation := ActivationFlagSet{relVerify,stringCenter};
gadgetType := strGadget;
specialInfo := ADR(TextInfo);
END;
OKGadg.nextGadget := ADR(CancelGadg);
WITH TextInfo DO
buffer := ADR(PixName);
undoBuffer := NIL;
bufferPos := 0;
maxChars := 80;
dispPos := 0;
numChars := Length(PixName);
END;
(*------ Window: ------*)
WITH NuWindow DO
leftEdge := 200; topEdge := 105;
width := 240; height := 46;
detailPen := 0; blockPen := 1;
idcmpFlags := IDCMPFlagSet{gadgetDown,gadgetUp};
flags := WindowFlagSet{windowDrag,activate,noCareRefresh};
firstGadget:= ADR(TextGadg);
checkMark := NIL;
title := ADR("Print It! Picture's Name:");
screen := NIL;
bitMap := NIL;
type := ScreenFlagSet{wbenchScreen};
END;
NameWindow := OpenWindow(NuWindow);
(*------ Draw into Window: ------*)
WITH NameWindow^ DO
SetAPen(rPort,2); SetDrMd(rPort,jam1);
Move(rPort, 8, 14); Draw(rPort,232, 14); Draw(rPort,232, 26);
Draw(rPort, 8, 26); Draw(rPort, 8, 14);
Move(rPort,164, 30); Draw(rPort,232, 30); Draw(rPort,232, 42);
Draw(rPort,164, 42); Draw(rPort,164, 30);
Move(rPort, 8, 30); Draw(rPort, 76, 30); Draw(rPort, 76, 42);
Draw(rPort, 8, 42); Draw(rPort, 8, 30);
SetAPen(rPort,1);
Type(rPort,190, 39,ADR("OK"));
Type(rPort, 18, 39,ADR("Cancel"));
END;
(*------ Wait for Input: ------*)
WaitPort(NameWindow^.userPort);
Msg := GetMsg(NameWindow^.userPort);
gadget := Msg^.iAddress;
ReplyMsg(Msg);
CloseWindow(NameWindow);
NameWindow := NIL;
IF gadget=ADR(CancelGadg) THEN Terminate(0) END;
END GetName;
(*-------------------------------------------------------------------------*)
(* *)
(* Set Gadgets to their values: *)
(* *)
(*-------------------------------------------------------------------------*)
PROCEDURE InitPrintIt();
VAR
ax,ay: LONGINT; (* to draw Aspect *)
BEGIN
RefreshGadgets(ADR(Gadgs),Window,NIL);
(*------ Set Gadgets to their values: ------*)
FOR IDCount := hori1ID TO ResetID DO
WITH Gadgs[IDCount] DO
flags := flags - GadgetFlagSet{selected};
END;
END;
INCL(Gadgs[Gadgets(StretchX-1)].flags,selected);
INCL(Gadgs[Gadgets(StretchY+7)].flags,selected);
IF DoublePrint THEN
INCL(Gadgs[PrintDoubleID].flags,selected);
ELSE
INCL(Gadgs[PrintNormalID].flags,selected);
END;
SetDrMd(RP,jam2); SetAPen(RP,1); SetBPen(RP,0);
IF Positive THEN
Type(RP,9,51,ADR("Positive"));
ELSE
Type(RP,9,51,ADR("Negative"));
END;
INCL(Gadgs[xRes].flags,selected);
INCL(Gadgs[yRes].flags,selected);
(*------ Type Pic's Name: ------*)
SetAPen(RP,0); SetDrMd(RP,jam1);
RectFill(RP,48,16,256,24);
SetAPen(RP,1);
Type(RP,48,23,ADR(PixName));
(*------ Refresh: ------*)
RefreshGadgets(ADR(Gadgs),Window,NIL);
(*------ Aspect: ------*)
SetAPen(RP,0); SetDrMd(RP,jam1);
RectFill(RP,137,109,247,139);
WITH Screen^ DO
ax := LONGINT(Screen^.width ) * LONGINT(StretchX) * 2;
ay := LONGINT(Screen^.height) * LONGINT(StretchY);
END;
CASE xRes OF
DpiH60ID: ay := ay * 60; |
DpiH72ID: ay := ay * 72; |
DpiH80ID: ay := ay * 80; |
DpiH90ID: ay := ay * 90; |
DpiH120ID: ay := ay * 120; |
DpiH144ID: ay := ay * 144; |
DpiH240ID: ay := ay * 216; |
END;
CASE yRes OF
DpiV72ID: ax := ax * 72; |
DpiV144ID: ax := ax * 144; |
DpiV216ID: ax := ax * 216; |
END;
IF (ax * 28 DIV ay) > 108 THEN
ay := ay * 54 DIV ax;
ax := 54;
ELSE
ax := ax * 14 DIV ay;
ay := 14;
END;
SetAPen(RP,2);
RectFill(RP,192-ax,124-ay,192+ax,124+ay);
SetAPen(RP,1);
Type(RP,168,127,ADR("Aspect"));
END InitPrintIt;
(*-------------------------------------------------------------------------*)
(* *)
(* Ask to Convert Colors and do it after that: *)
(* *)
(*-------------------------------------------------------------------------*)
PROCEDURE Convert();
VAR
ColScales: ARRAY[0..63] OF CARDINAL;
B1,B2: POINTER TO LONGCARD;
NewBitMap,bm: BitMap;
BEGIN
(*------ Gadgets: ------*)
FOR i:=0 TO 15 DO
SetBool(ShadeGadget[i],9+i*24,25,23,11);
ShadeGadget[i].gadgetID := i;
END;
SetBool(UsePlaneGadget, 9,45,127,11);
SetBool(ScaleGadget ,153,45, 95,11);
SetBool(ConvertGadget ,265,45,127,11);
FOR i:=0 TO 14 DO
ShadeGadget[i].nextGadget := ADR(ShadeGadget[i+1]);
END;
ShadeGadget[15].nextGadget := ADR(UsePlaneGadget);
UsePlaneGadget.nextGadget := ADR(ConvertGadget);
ConvertGadget.nextGadget := ADR(ScaleGadget);
(*------ Window: ------*)
WITH NuWindow DO
leftEdge := 120; topEdge := 98;
width := 400; height := 60;
detailPen := 0; blockPen := 1;
idcmpFlags := IDCMPFlagSet{gadgetDown,gadgetUp};
flags := WindowFlagSet{windowDrag,activate,noCareRefresh};
firstGadget:= ADR(ShadeGadget);
checkMark := NIL;
title := ADR("Print It !");
screen := NIL;
bitMap := NIL;
type := ScreenFlagSet{wbenchScreen};
END;
ConvertWindow := OpenWindow(NuWindow);
(*------ Draw into Window: ------*)
WITH ConvertWindow^ DO
SetAPen(rPort,1); SetDrMd(rPort,jam1);
Type(rPort, 8,19,ADR("That's a Color Picture !"));
Type(rPort, 16,33,ADR("0 1 2 3 4 5 6 7 8 9"));
Type(rPort,252,33,ADR("10 11 12 13 14 15"));
Type(rPort, 16,53,ADR("Use Plane # Grey Scale Convert Pic."));
SetAPen(rPort,2);
FOR i:=8 TO 368 BY 24 DO
Box(rPort,i,24,i+24,36);
END;
Box(rPort, 8,44,136,56);
Box(rPort,152,44,248,56);
Box(rPort,264,44,392,56);
IF Shade < Screen^.bitMap.depth THEN
PlaneString[0] := CHAR(Shade+ORD("0"));
ELSE
PlaneString[0] := "0";
END;
PlaneString[1] := CHAR(0);
WITH ConvertWindow^ DO
SetDrMd(rPort,jam2); SetAPen(rPort,1); SetBPen(rPort,0);
Type(rPort,112,53,ADR(PlaneString));
END;
END;
INCL(ShadeGadget[Shade].flags,selected);
RefreshGadgets(ADR(ShadeGadget),ConvertWindow,NIL);
(*------ Wait for Input: ------*)
LOOP
WaitPort(ConvertWindow^.userPort);
Msg := GetMsg(ConvertWindow^.userPort);
gadget := Msg^.iAddress;
ReplyMsg(Msg);
IF (gadget#ADR(UsePlaneGadget))
AND (gadget#ADR( ConvertGadget))
AND (gadget#ADR( ScaleGadget)) THEN
gadget^.flags := gadget^.flags / GadgetFlagSet{selected};
RefreshGadgets(ADR(ShadeGadget),ConvertWindow,NIL);
INCL(gadget^.flags,selected);
Shade := gadget^.gadgetID;
IF Shade < Screen^.bitMap.depth THEN
PlaneString[0] := CHAR(Shade+ORD("0"));
ELSE
PlaneString[0] := "0";
END;
PlaneString[1] := CHAR(0);
WITH ConvertWindow^ DO
SetDrMd(rPort,jam2); SetAPen(rPort,1); SetBPen(rPort,0);
Type(rPort,112,53,ADR(PlaneString));
END;
ELSE
ScreenToFront(Screen);
WITH Screen^ DO
IF gadget=ADR(ConvertGadget) THEN
(*------ Convert Pic: ------*)
WordPtr := viewPort.colorMap^.colorTable;
LightColors := LONGSET{};
FOR i:=0 TO viewPort.colorMap^.count-1 DO
Color := SHIFT(CAST(CARDINAL,WordPtr^ * {8..11}),-8)
+ SHIFT(CAST(CARDINAL,WordPtr^ * {4..7} ),-4)
+ CAST(CARDINAL,WordPtr^ * {0..3});
Color := Color DIV 3;
IF Color>=Shade THEN
INCL(LightColors,i);
END;
INC(WordPtr,2);
END;
SetRGB4(ADR(viewPort),0,15,15,15); (* white *)
SetRGB4(ADR(viewPort),1, 0, 0, 0); (* black *)
SetDrMd(ADR(rastPort),jam1);
FOR y:=0 TO height-1 DO
FOR x:=0 TO width-1 DO
IF ReadPixel(ADR(rastPort),x,y) IN LightColors THEN
SetAPen(ADR(rastPort),0);
ELSE
SetAPen(ADR(rastPort),1);
END;
li := WritePixel(ADR(rastPort),x,y);
END;
END;
EXIT;
ELSIF gadget=ADR(ScaleGadget) THEN
(*------ Produce GreyScale: ------*)
WITH NuScreen DO
leftEdge := 0;
topEdge := 0;
width := 640;
height := 16;
depth := 1;
detailPen:= 0;
blockPen := 0;
viewModes:= ViewModeSet{hires,lace};
type := customScreen + ScreenFlagSet{screenQuiet};
defaultTitle := NIL;
font := NIL;
gadgets := NIL;
customBitMap := NIL;
END;
GreyScreen := OpenScreen(NuScreen);
IF GreyScreen#NIL THEN
WITH NewBitMap DO
bytesPerRow := 2 * bitMap.bytesPerRow;
rows := 2 * bitMap.rows;
flags := bitMap.flags;
depth := 1;
planes[0] := AllocMem(LONGINT(rows) * LONGINT(bytesPerRow),MemReqSet{chip,memClear});
END;
IF NewBitMap.planes[0]=NIL THEN
CloseScreen(GreyScreen);
GreyScreen := NIL;
ELSE
bm := GreyScreen^.bitMap; GreyScreen^.bitMap := NewBitMap;
IF NewBitMap.rows>512 THEN
GreyScreen^.height := 512;
GreyScreen^.viewPort.dHeight := 512;
ELSE
GreyScreen^.height := NewBitMap.rows;
GreyScreen^.viewPort.dHeight := NewBitMap.rows;
END;
SetRGB4(ADR(GreyScreen^.viewPort),0,15,15,15); (* white *)
SetRGB4(ADR(GreyScreen^.viewPort),1, 0, 0, 0); (* black *)
MakeScreen(GreyScreen); RethinkDisplay();
FreeMem(bm.planes[0],bm.rows * bm.bytesPerRow);
WordPtr := viewPort.colorMap^.colorTable; (* Pogo! *)
FOR i:=0 TO viewPort.colorMap^.count-1 DO
Color := SHIFT(CAST(CARDINAL,WordPtr^ * {8..11}),-8)
+ SHIFT(CAST(CARDINAL,WordPtr^ * {4..7} ),-4)
+ CAST(CARDINAL,WordPtr^ * {0..3});
ColScales[i] := 4 - Color*5 DIV 48;
INC(WordPtr,2);
END;
B1 := NewBitMap.planes[0];
B2 := B1; INC(B2,NewBitMap.bytesPerRow);
y := 0;
WHILE y<CARDINAL(height) DO
x := 0;
WHILE x<CARDINAL(width) DO
FOR i:=0 TO 15 DO
j := ColScales[ReadPixel(ADR(rastPort),x+i,y)];
INC(B1^,Scales[j,i,0]);
INC(B2^,Scales[j,i,1]);
END;
INC(B1,4);
INC(B2,4);
INC(x,16);
END;
INC(B1,NewBitMap.bytesPerRow);
INC(B2,NewBitMap.bytesPerRow);
INC(y);
END;
CloseScreen(Screen);
Screen := GreyScreen;
GreyScreen := NIL;
EXIT;
END; (* IF OOM THEN *)
ELSE
DisplayBeep(NIL);
IF WBenchToFront() THEN END;
END;
ELSE
(*------ Delete unwanted Planes: ------*)
SetRGB4(ADR(viewPort),0,15,15,15); (* white *)
SetRGB4(ADR(viewPort),1, 0, 0, 0); (* black *)
IF (Shade<bitMap.depth) AND (Shade#0) THEN
map := bitMap.planes[Shade];
bitMap.planes[Shade] := bitMap.planes[0];
bitMap.planes[0] := map;
END;
i := 1;
WHILE i<bitMap.depth DO
BltClear(bitMap.planes[i],bitMap.bytesPerRow * bitMap.rows,0);
INC(i);
END;
EXIT;
END;
END; (* WITH Screen^ DO *)
END; (* IF gadget#Use,Convert,Scale THEN ELSE *)
END; (* LOOP *)
RethinkDisplay();
IF WBenchToFront() THEN END;
CloseWindow(ConvertWindow);
ConvertWindow := NIL;
END Convert;
(*------------------------------ CleanUp: -------------------------------*)
PROCEDURE CleanUp();
BEGIN
IF NameWindow#NIL THEN CloseWindow(NameWindow) END;
IF ConvertWindow#NIL THEN CloseWindow(ConvertWindow) END;
IF GreyScreen#NIL THEN CloseScreen(GreyScreen) END;
END CleanUp;
(*--------------------------- Initialization: ---------------------------*)
BEGIN
StretchX := 1; StretchY := 1;
DoublePrint := FALSE;
xRes := DpiH240ID;
yRes := DpiV216ID;
Positive := TRUE;
NameWindow := NIL;
ConvertWindow := NIL;
PixName := "Name.iff";
Shade := 8;
GreyScreen := NIL;
TermProcedure(CleanUp);
(*------ Set Up Scales: ------*)
Scales[0,15,0] := 0; Scales[0,15,1] := 0;
Scales[1,15,0] := 1; Scales[1,15,1] := 0;
Scales[2,15,0] := 2; Scales[2,15,1] := 1;
Scales[3,15,0] := 1; Scales[3,15,1] := 3;
Scales[4,15,0] := 3; Scales[4,15,1] := 3;
i := 15;
WHILE i>0 DO
DEC(i);
FOR j:=0 TO 4 DO
Scales[j,i,0] := SHIFT(Scales[j,i+1,0],2);
Scales[j,i,1] := SHIFT(Scales[j,i+1,1],2);
END;
END;
END PrintItDisplay.